package com.kyub.spring.gears.web.upload;

import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.ProgressListener;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * Resolver for file upload
 */
public class GearsMultipartResolver extends CommonsMultipartResolver {

    private ProgressListener pListener;


    public ProgressListener getPListener() {
        return pListener;
    }

    public void setPListener(ProgressListener pListener) {
        this.pListener = pListener;
    }


    protected FileUpload newFileUpload(FileItemFactory fileItemFactory) {
        final FileUpload fileUpload = super.newFileUpload(fileItemFactory);
        fileUpload.setProgressListener(pListener);
        return fileUpload;
    }
}
